//
//  ToolBarButton.m
//  GuoBuJiaForIphone
//
//  Created by zhangwo on 16/11/15.
//  Copyright © 2016年 GuoBuJia. All rights reserved.
//

#import "ToolBarButton.h"

@implementation ToolBarButton
@synthesize image = _image;
@synthesize text = _text;

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    }
    return self;
}

-(void)setText:(NSString *)text
{
    _text = text;
    //self.titleLabel.text = text;
    [self setTitle:text forState:UIControlStateNormal];
}

-(void)setImage:(UIImage *)image
{
    _image = image;
    //self.imageView.image = image;
    [self setImage:image forState:UIControlStateNormal];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.imageView.frame = CGRectMake(15, 2, 23, 23);
    self.titleLabel.frame = CGRectMake(0, 25, 50, 20);
    self.titleLabel.font = [UIFont systemFontOfSize:12.0];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
}

@end
